package ch.zhaw.cctd.logic.network;

import java.awt.Dimension;
import java.awt.Point;
import java.awt.Rectangle;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.List;
import java.util.Map;

import ch.zhaw.cctd.domain.GraphicalElement;
import ch.zhaw.cctd.domain.creep.Creep;
import ch.zhaw.cctd.domain.map.MapElement;
import ch.zhaw.cctd.domain.player.Player;
import ch.zhaw.cctd.domain.player.RessourceException;
import ch.zhaw.cctd.domain.prototype.PrototypeList;
import ch.zhaw.cctd.domain.prototype.TowerPrototype;
import ch.zhaw.cctd.domain.shot.Shot;
import ch.zhaw.cctd.domain.tower.Tower;
import ch.zhaw.cctd.domain.tower.TowerBuildException;
import ch.zhaw.cctd.logic.event.EventHandler;

/**
 * Stellt alle Server-Informationen für die Clients zur Verfügung.
 * @author Benjamin Felder
 * @author Rolf Koch
 */
public interface RemoteServer extends Remote {
	
	public EventHandler getEventHandler() throws RemoteException;
	
	public PrototypeList getPrototypeList() throws RemoteException;

	public List<? extends GraphicalElement> getStaticMapObjects() throws RemoteException;
	
	public List<? extends GraphicalElement> getTowersMapObjects() throws RemoteException;
	
	public List<? extends GraphicalElement> getMovableMapObjects() throws RemoteException;

	public void startMatch() throws RemoteException;

	public void addPlayer(Player player) throws RemoteException;

	public void win() throws RemoteException;

	public void lose() throws RemoteException;

	public int getPlayerCount() throws RemoteException;

	public List<Tower> getTowerList() throws RemoteException;

	public List<Creep> getCreepList() throws RemoteException;

	public List<Shot> getShotList() throws RemoteException;

	public void buildTower(TowerPrototype towerPrototype, Point point, int ownerId) throws RemoteException, RessourceException, TowerBuildException;

	public MapElement getMapObject(Point p) throws RemoteException;

	public Player getPlayer(int playerId) throws RemoteException;

	public void ressourceTransfer(int playerId, int targetPlayerId, int amount) throws RemoteException;
	
	public int registerClient(RemoteClient rc) throws RemoteException, IllegalStateException;

	void checkClients() throws RemoteException;
	
	void unregisterClient(RemoteClient rc) throws RemoteException;

	public Dimension getMapSize() throws RemoteException; 
	
	public boolean isStarted() throws RemoteException;

	public Map<Integer, String> getPlayerMap() throws RemoteException;
	
	public int getWaveNumber() throws RemoteException;
	
	public int getMoneyByPlayer(int playerId) throws RemoteException;
	
	public int getCreepCount() throws RemoteException;

	public int getPlayerMoney(int playerId) throws RemoteException;

	public Point isValidTowerBuildLocation(Rectangle rect, int playerId) throws RemoteException;
}
